import { ref } from 'vue';

const isLoggedIn = ref(localStorage.getItem('isLoggedIn') === 'true');

const login = () => {
  isLoggedIn.value = true;
  localStorage.setItem('isLoggedIn', 'true');
};

const logout = () => {
  isLoggedIn.value = false;
  localStorage.removeItem('isLoggedIn');
  localStorage.removeItem('accessToken');
  localStorage.removeItem('uuid');
  //请求后端清除缓存数据
};

export { isLoggedIn, login, logout }; 